package com.dayaokeji.rhythmschoolstudent.view;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;

import com.dayaokeji.rhythmschoolstudent.R;


public class RefreshLayout extends SwipeRefreshLayout {
    private static final int DEFAULT_DISTANCE_TO_TRIGGER_SYNC_DP = 160;

    public RefreshLayout(Context context) {
        super(context);
        init(context);
    }

    public RefreshLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    private void init(Context context) {
        Resources resources = context.getResources();
        setColorSchemeColors(Color.parseColor("#00B3FE"),Color.parseColor("#0083FD"));
        setDistanceToTriggerSync((int) (resources.getDisplayMetrics().density * DEFAULT_DISTANCE_TO_TRIGGER_SYNC_DP + 0.5f));
    }
}
